﻿using System;
using System.Collections.Generic;
using System.Windows.Data;
using System.Globalization;
using Asistente.Model.Representation;

namespace Asistente.Converters
{
    class EntitiesCollectionNameConverter:IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            List<Entity> collection = value as List<Entity>;
            String name = "";
            if (collection != null)
                if (collection.Count > 0)
                {
                    name = collection[0].Name;
                    for (Int32 i = 1; i < collection.Count; i++)
                    {
                        name += " - " + collection[i].Name;
                    }
                }
            return name;
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            throw new NotImplementedException();
        }
    }
}
